#ifndef   M_Code_STATUSBAR_H
#define   M_Code_STATUSBAR_H

#include <vector>
#include <wx/statusbr.h>

class M_Code_Plugin;

class M_Code_StatusBar : public wxStatusBar {
  private:
    friend class MainFrame;
    M_Code_StatusBar( wxWindow* parent,  wxWindowID id, long style, const wxString& name );
    M_Code_StatusBar() { ; };
    M_Code_StatusBar( const M_Code_StatusBar& );
    virtual ~M_Code_StatusBar();
  public:
    virtual void SetStatusTextByPlugin( const wxString& text, M_Code_Plugin* plugin );
    virtual wxString GetStatusTextByPlugin( M_Code_Plugin* plugin ) const;
    virtual bool GetFieldRectByPlugin( M_Code_Plugin *plugin, wxRect& rect ) const;
    virtual void SetStatusWidths( int n, const int* widths );
    void AddField( M_Code_Plugin* plugin, wxWindow* ctrl, int width );
    void AddField( M_Code_Plugin* plugin, int width );
    void RemoveField( M_Code_Plugin* plugin );
  private:
    void OnSize( wxSizeEvent& event );
    void UpdateWidths();
    void AdjustFieldsSize();
    int  GetFieldNumberOfPlugin( M_Code_Plugin* plugin ) const;
    void PushStatusText( M_Code_unused const wxString& text, M_Code_unused M_Code_Plugin *plugin ) { ; };
    void PopStatusText( M_Code_unused M_Code_Plugin* plugin ) { ; };
    struct cbStatusBarElement {
      int width;
      wxWindow *control;
      M_Code_Plugin *plugin;
    };
    typedef std::vector<cbStatusBarElement> ElementVector;
    ElementVector m_Elements;
    std::vector<int> m_MainWidths;

    DECLARE_EVENT_TABLE()
};

#endif
